package com.ruoyi.project.treat.controller;

import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.treat.domain.TrePatient;
import com.ruoyi.project.treat.domain.TreRegCost;
import com.ruoyi.project.treat.service.ITreRegCostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/treat/treRegCost")
public class TreRegCostController {

    @Autowired
    private ITreRegCostService treRegCostService;

    @RequestMapping("/price")
    @PreAuthorize("@ss.hasPermi('treat:register:index')")
    public AjaxResult getPriceByName(@PathVariable String regName){
        TreRegCost treRegCost = treRegCostService.getByName(regName);
        return AjaxResult.success(treRegCost);
    }

    @RequestMapping("/all")
    @PreAuthorize("@ss.hasPermi('treat:register:index')")
    public AjaxResult findAll(){
        return AjaxResult.success(treRegCostService.findAll());
    }

}
